#!/usr/bin/env perl

use Test::More tests => 1;
use Data::Dumper;
use Test::MockObject::Extends;

use WWW::Reddit;

my $r = WWW::Reddit->new( username => '',
                          password => '' );


my $mech = $r->get_mech();
$mech = Test::MockObject::Extends->new( $mech );
$mech->set_always( 'get', '' ); # stop Mech from actually fetching things
my $feed = join( '', <DATA> );
$mech->set_always( 'content', $feed ); # return our page from __DATA__
$r->set_mech( $mech );

my @idlist = $r->get_ids_from_feed();
ok( scalar( @idlist ) > 4, 'we got some ids back' ) or
  diag( Data::Dumper->Dump( [ \@idlist ], [ 'idlist' ] ) );

__DATA__;
<?xml version="1.0" encoding="UTF-8"?>


<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>
reddit.com: what's new online
</title>        
    <link>http://reddit.com/</link>
    <description>None</description>
    

  

<item>
  <title>Top 10 reasons you might want to avoid taking this class</title>
  <link>http://reddit.com/goto?rss=true&amp;id=t3_63lc4</link>
  <guid>http://reddit.com/goto?rss=true&amp;id=t3_63lc4</guid>
  <dc:date>2007-12-21T11:18:24.552362+00:00</dc:date>
  <description>&lt;a href="http://www.cs.iastate.edu/~leavens/ComS541Fall05/docs/top-10-reasons-not-to-take-541.txt"&gt;[link]&lt;/a&gt;&lt;a href="http://programming.reddit.com/info/63lc4/comments/"&gt;[more]&lt;/a&gt;</description>
</item>


  

<item>
  <title>Flags [PIC]</title>
  <link>http://reddit.com/goto?rss=true&amp;id=t3_63kwf</link>
  <guid>http://reddit.com/goto?rss=true&amp;id=t3_63kwf</guid>
  <dc:date>2007-12-21T06:22:55.722292+00:00</dc:date>
  <description>&lt;a href="http://presscue.com/node/30899"&gt;[link]&lt;/a&gt;&lt;a href="http://reddit.com/info/63kwf/comments/"&gt;[more]&lt;/a&gt;</description>
</item>


  

<item>
  <title>Map of the new U.S.A., with a hole in the middle.</title>
  <link>http://reddit.com/goto?rss=true&amp;id=t3_63kxs</link>
  <guid>http://reddit.com/goto?rss=true&amp;id=t3_63kxs</guid>
  <dc:date>2007-12-21T06:43:55.456593+00:00</dc:date>
  <description>&lt;a href="http://users.dma.ucla.edu/~estevancarlos/images/lakotanation.jpg"&gt;[link]&lt;/a&gt;&lt;a href="http://politics.reddit.com/info/63kxs/comments/"&gt;[more]&lt;/a&gt;</description>
</item>


  

<item>
  <title> Schwarzenegger: California will sue federal government</title>
  <link>http://reddit.com/goto?rss=true&amp;id=t3_63kt4</link>
  <guid>http://reddit.com/goto?rss=true&amp;id=t3_63kt4</guid>
  <dc:date>2007-12-21T05:25:57.046393+00:00</dc:date>
  <description>&lt;a href="http://www.cnn.com/2007/POLITICS/12/20/california.emissions/"&gt;[link]&lt;/a&gt;&lt;a href="http://reddit.com/info/63kt4/comments/"&gt;[more]&lt;/a&gt;</description>
</item>


  

<item>
  <title>The most meaningful 404 page *ever*</title>
  <link>http://reddit.com/goto?rss=true&amp;id=t3_63lcq</link>
  <guid>http://reddit.com/goto?rss=true&amp;id=t3_63lcq</guid>
  <dc:date>2007-12-21T11:30:19.522578+00:00</dc:date>
  <description>&lt;a href="http://un-america.com/"&gt;[link]&lt;/a&gt;&lt;a href="http://politics.reddit.com/info/63lcq/comments/"&gt;[more]&lt;/a&gt;</description>
</item>


  

<item>
  <title>FBI Confiscated $400K from Man, who is Charged with no Crime</title>
  <link>http://reddit.com/goto?rss=true&amp;id=t3_63l0r</link>
  <guid>http://reddit.com/goto?rss=true&amp;id=t3_63l0r</guid>
  <dc:date>2007-12-21T07:46:07.864272+00:00</dc:date>
  <description>&lt;a href="http://www.limaohio.com/story.php?IDnum=47047"&gt;[link]&lt;/a&gt;&lt;a href="http://reddit.com/info/63l0r/comments/"&gt;[more]&lt;/a&gt;</description>
</item>


  

<item>
  <title>Seven commonly held beliefs, published today in the British Medical Journal, debunked</title>
  <link>http://reddit.com/goto?rss=true&amp;id=t3_63l11</link>
  <guid>http://reddit.com/goto?rss=true&amp;id=t3_63l11</guid>
  <dc:date>2007-12-21T07:52:22.179562+00:00</dc:date>
  <description>&lt;a href="http://www.guardian.co.uk/science/2007/dec/21/medicalresearch"&gt;[link]&lt;/a&gt;&lt;a href="http://reddit.com/info/63l11/comments/"&gt;[more]&lt;/a&gt;</description>
</item>


  

<item>
  <title>Splashy pants saved!</title>
  <link>http://reddit.com/goto?rss=true&amp;id=t3_63l2u</link>
  <guid>http://reddit.com/goto?rss=true&amp;id=t3_63l2u</guid>
  <dc:date>2007-12-21T08:28:21.449172+00:00</dc:date>
  <description>&lt;a href="http://news.bbc.co.uk/1/hi/uk/7155255.stm"&gt;[link]&lt;/a&gt;&lt;a href="http://reddit.com/info/63l2u/comments/"&gt;[more]&lt;/a&gt;</description>
</item>


  

<item>
  <title>To our Millitary: When our government orders you to turn on us, will you obey?</title>
  <link>http://reddit.com/goto?rss=true&amp;id=t3_63kos</link>
  <guid>http://reddit.com/goto?rss=true&amp;id=t3_63kos</guid>
  <dc:date>2007-12-21T04:24:57.252544+00:00</dc:date>
  <description>&lt;a href="http://politics.reddit.com/info/63kos/comments/"&gt;[link]&lt;/a&gt;&lt;a href="http://politics.reddit.com/info/63kos/comments/"&gt;[more]&lt;/a&gt;</description>
</item>


  

<item>
  <title>Why Nintendo can't ship enough Wii consoles [comic]</title>
  <link>http://reddit.com/goto?rss=true&amp;id=t3_63kzv</link>
  <guid>http://reddit.com/goto?rss=true&amp;id=t3_63kzv</guid>
  <dc:date>2007-12-21T07:26:40.201333+00:00</dc:date>
  <description>&lt;a href="http://www.joyoftech.com/joyoftech/index.html"&gt;[link]&lt;/a&gt;&lt;a href="http://reddit.com/info/63kzv/comments/"&gt;[more]&lt;/a&gt;</description>
</item>


  

<item>
  <title>Focusing on what matters... (pic)</title>
  <link>http://reddit.com/goto?rss=true&amp;id=t3_63jr5</link>
  <guid>http://reddit.com/goto?rss=true&amp;id=t3_63jr5</guid>
  <dc:date>2007-12-20T21:07:08.370619+00:00</dc:date>
  <description>&lt;a href="http://bp1.blogger.com/_SDqU7KTqq1M/R2n2xTnhXKI/AAAAAAAAAHc/P-Ry9yr_QF8/s1600-h/cnn-britney.jpg"&gt;[link]&lt;/a&gt;&lt;a href="http://politics.reddit.com/info/63jr5/comments/"&gt;[more]&lt;/a&gt;</description>
</item>


  

<item>
  <title>Asteroid may hit Mars in next month - Yahoo! News</title>
  <link>http://reddit.com/goto?rss=true&amp;id=t3_63kie</link>
  <guid>http://reddit.com/goto?rss=true&amp;id=t3_63kie</guid>
  <dc:date>2007-12-21T02:51:49.606289+00:00</dc:date>
  <description>&lt;a href="http://news.yahoo.com/s/ap/20071221/ap_on_sc/mars_asteroid;_ylt=AlYgoO0coPnn5qFxi07KGGis0NUE"&gt;[link]&lt;/a&gt;&lt;a href="http://science.reddit.com/info/63kie/comments/"&gt;[more]&lt;/a&gt;</description>
</item>


  

<item>
  <title>When one e-mail is enough to break a system</title>
  <link>http://reddit.com/goto?rss=true&amp;id=t3_63kzy</link>
  <guid>http://reddit.com/goto?rss=true&amp;id=t3_63kzy</guid>
  <dc:date>2007-12-21T07:27:55.395404+00:00</dc:date>
  <description>&lt;a href="http://log.does-not-exist.org/archives/2007/12/19/2159_more_on_widgets_when_one_email_is_enough_to_break_a_system.html"&gt;[link]&lt;/a&gt;&lt;a href="http://programming.reddit.com/info/63kzy/comments/"&gt;[more]&lt;/a&gt;</description>
</item>


  

<item>
  <title>Lakota Indians Withdraw Treaties Signed With U.S. 150 Years Ago...and secede.</title>
  <link>http://reddit.com/goto?rss=true&amp;id=t3_63khq</link>
  <guid>http://reddit.com/goto?rss=true&amp;id=t3_63khq</guid>
  <dc:date>2007-12-21T02:42:14.320884+00:00</dc:date>
  <description>&lt;a href="http://www.foxnews.com/story/0,2933,317548,00.html"&gt;[link]&lt;/a&gt;&lt;a href="http://politics.reddit.com/info/63khq/comments/"&gt;[more]&lt;/a&gt;</description>
</item>


  

<item>
  <title>&quot;Daily Show&quot; and &quot;Colbert Report&quot; To Return In January — Without Writers</title>
  <link>http://reddit.com/goto?rss=true&amp;id=t3_63k9b</link>
  <guid>http://reddit.com/goto?rss=true&amp;id=t3_63k9b</guid>
  <dc:date>2007-12-21T00:16:50.383869+00:00</dc:date>
  <description>&lt;a href="http://www.huffingtonpost.com/2007/12/20/daily-show-and-colbert_n_77784.html"&gt;[link]&lt;/a&gt;&lt;a href="http://politics.reddit.com/info/63k9b/comments/"&gt;[more]&lt;/a&gt;</description>
</item>


  

<item>
  <title>Suppose Iraq invaded America. And an Iraqi soldier was on a tank passing through an American street, waving his gun at the people, threatening them, raiding and trashing houses. Would you accept that?</title>
  <link>http://reddit.com/goto?rss=true&amp;id=t3_63l50</link>
  <guid>http://reddit.com/goto?rss=true&amp;id=t3_63l50</guid>
  <dc:date>2007-12-21T09:12:58.604224+00:00</dc:date>
  <description>&lt;a href="http://www.alternet.org/waroniraq/71253/"&gt;[link]&lt;/a&gt;&lt;a href="http://politics.reddit.com/info/63l50/comments/"&gt;[more]&lt;/a&gt;</description>
</item>


  

<item>
  <title>Paul Krugman tells the kids at Google &quot;all hell is going to break loose.&quot; (non-linkjack version)</title>
  <link>http://reddit.com/goto?rss=true&amp;id=t3_63lhu</link>
  <guid>http://reddit.com/goto?rss=true&amp;id=t3_63lhu</guid>
  <dc:date>2007-12-21T12:48:30.991048+00:00</dc:date>
  <description>&lt;a href="http://www.youtube.com/watch?v=4XhvG_fD0HA"&gt;[link]&lt;/a&gt;&lt;a href="http://reddit.com/info/63lhu/comments/"&gt;[more]&lt;/a&gt;</description>
</item>


  

<item>
  <title>FBI Now Admits Evidence Used to Connect Oswald to Kennedy Assasination Was Bogus</title>
  <link>http://reddit.com/goto?rss=true&amp;id=t3_63k7v</link>
  <guid>http://reddit.com/goto?rss=true&amp;id=t3_63k7v</guid>
  <dc:date>2007-12-20T23:57:51.815586+00:00</dc:date>
  <description>&lt;a href="http://truthalliance.net/News/CommunityPublications/tabid/76/articleType/ArticleView/articleId/331/Default.aspx"&gt;[link]&lt;/a&gt;&lt;a href="http://politics.reddit.com/info/63k7v/comments/"&gt;[more]&lt;/a&gt;</description>
</item>


  

<item>
  <title>Should Nancy Pelosi Step down as Speaker? </title>
  <link>http://reddit.com/goto?rss=true&amp;id=t3_63jik</link>
  <guid>http://reddit.com/goto?rss=true&amp;id=t3_63jik</guid>
  <dc:date>2007-12-20T19:41:39.492170+00:00</dc:date>
  <description>&lt;a href="http://www.dailykos.com/storyonly/2007/12/20/134347/22/274/424826"&gt;[link]&lt;/a&gt;&lt;a href="http://politics.reddit.com/info/63jik/comments/"&gt;[more]&lt;/a&gt;</description>
</item>


  

<item>
  <title>Vladimir Putin and his $40 billion -- WTF? -- fortune</title>
  <link>http://reddit.com/goto?rss=true&amp;id=t3_63kh7</link>
  <guid>http://reddit.com/goto?rss=true&amp;id=t3_63kh7</guid>
  <dc:date>2007-12-21T02:32:56.662288+00:00</dc:date>
  <description>&lt;a href="http://www.guardian.co.uk/russia/article/0,,2230924,00.html"&gt;[link]&lt;/a&gt;&lt;a href="http://reddit.com/info/63kh7/comments/"&gt;[more]&lt;/a&gt;</description>
</item>


  

<item>
  <title>Linked Lists - Incompatible with Parallel Programming?</title>
  <link>http://reddit.com/goto?rss=true&amp;id=t3_63lby</link>
  <guid>http://reddit.com/goto?rss=true&amp;id=t3_63lby</guid>
  <dc:date>2007-12-21T11:16:29.716661+00:00</dc:date>
  <description>&lt;a href="http://softwareblogs.intel.com/2007/12/20/linked-lists-incompatible-with-parallel-programming/"&gt;[link]&lt;/a&gt;&lt;a href="http://programming.reddit.com/info/63lby/comments/"&gt;[more]&lt;/a&gt;</description>
</item>


  

<item>
  <title>An incredibly long list of Bush administration scandals. This is painfully enraging.</title>
  <link>http://reddit.com/goto?rss=true&amp;id=t3_63l4k</link>
  <guid>http://reddit.com/goto?rss=true&amp;id=t3_63l4k</guid>
  <dc:date>2007-12-21T09:00:30.199840+00:00</dc:date>
  <description>&lt;a href="http://www.netrootsmass.net/Hugh/Bush_list.html?"&gt;[link]&lt;/a&gt;&lt;a href="http://politics.reddit.com/info/63l4k/comments/"&gt;[more]&lt;/a&gt;</description>
</item>


  

<item>
  <title>Student sent home for wearing shirt that said &quot;Gay? Fine by me&quot;</title>
  <link>http://reddit.com/goto?rss=true&amp;id=t3_63ktr</link>
  <guid>http://reddit.com/goto?rss=true&amp;id=t3_63ktr</guid>
  <dc:date>2007-12-21T05:36:58.702435+00:00</dc:date>
  <description>&lt;a href="http://www.splc.org/newsflash.asp?id=1640"&gt;[link]&lt;/a&gt;&lt;a href="http://reddit.com/info/63ktr/comments/"&gt;[more]&lt;/a&gt;</description>
</item>


  

<item>
  <title>Really Cool Math Video</title>
  <link>http://reddit.com/goto?rss=true&amp;id=t3_63kmh</link>
  <guid>http://reddit.com/goto?rss=true&amp;id=t3_63kmh</guid>
  <dc:date>2007-12-21T03:55:57.371217+00:00</dc:date>
  <description>&lt;a href="http://www.sciencenews.org/articles/20071117/mathtrek.asp"&gt;[link]&lt;/a&gt;&lt;a href="http://reddit.com/info/63kmh/comments/"&gt;[more]&lt;/a&gt;</description>
</item>


  

<item>
  <title>Thank you Reuters. They've updated their candidate page and added Kucinich and Paul.</title>
  <link>http://reddit.com/goto?rss=true&amp;id=t3_63jro</link>
  <guid>http://reddit.com/goto?rss=true&amp;id=t3_63jro</guid>
  <dc:date>2007-12-20T21:12:08.803958+00:00</dc:date>
  <description>&lt;a href="http://www.reuters.com/news/globalcoverage/2008candidates?"&gt;[link]&lt;/a&gt;&lt;a href="http://politics.reddit.com/info/63jro/comments/"&gt;[more]&lt;/a&gt;</description>
</item>





  </channel>
</rss>  



